<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>卓恩寝居后台管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" th:href="@{/static/layui/css/layui.css}"  media="all">
    <script th:src="@{/static/layui/layui.js}" charset="utf-8"></script>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">卓恩寝居后台管理</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item"><a href="">控制台</a></li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;" th:if="${session.user != null}">
                    <!--<img th:src="@{/layui/images/face/0.gif}" class="layui-nav-img">-->
                    <img th:src="@{/static/img/default.png}" class="layui-nav-img">
                    <span th:text="${session.user.name}"></span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">基本资料</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="/user/logout"}>退出</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">常用管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="/category/listPage" target="content_iFrm">分类管理</a></dd>
                        <dd><a href="/product/listPage" target="content_iFrm">产品管理</a></dd>
                        <dd><a href="/shop/listPage" target="content_iFrm">店铺管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a href="javascript:;">系统管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="/webUser/listPage" target="content_iFrm">用户管理</a></dd>
                        <dd><a href="/role/listPage" target="content_iFrm">角色管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a onclick="updatePwd()">修改密码</a></li>
                <li class="layui-nav-item"><a href="#">注销功能</a></li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <iframe name="content_iFrm" frameborder="0" class="larry-iframe" style="width: 100%; height: 100%;"
                src="/category/listPage"
        ></iframe>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © layui.com - 底部固定区域
    </div>
</div>

<script>
    //JavaScript代码区域
    let element, $, layer;
    layui.use(['element','layer'], function(){
        element = layui.element;
        $ = layui.jquery;
        layer = layui.layer;
    });

    const updatePwd = ()=> {
        layer.prompt({
            formType: 1,
            value: '',
            title: '请输入新密码',
        }, function(value, index, elem){
            value = value.replace(/[\r\n ]/g, '')
            if(!value) {
                return layer.msg('不能输入特殊字符');
            }
            $.post('/user/edit', {pwd: value}, (res)=> {
                layer.msg(res.msg);
                if(res.code === 0 && res.data != null) layer.close(index);
            })
        });
    }
</script>
<script>
    // var _hmt = _hmt || [];
    // (function() {
    //     var hm = document.createElement("script");
    //     hm.src = "https://hm.baidu.com/hm.js?d214947968792b839fd669a4decaaffc";
    //     var s = document.getElementsByTagName("script")[0];
    //     s.parentNode.insertBefore(hm, s);
    // })();
</script>
</body>
</html>
